#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
//https://www.luogu.com.cn/problem/P9226


using namespace std;

int n, k;
int main()
{
	cin >> n >> k;
	cout << k - (n % k) << endl;


	return 0;
}